Skip to content

feat: Support optional spanKind override for InvokeAgentScope and ExecuteToolScope#213

Merged
nikhilNava merged 4 commits intomainfrom
copilot/implement-span-kind-dotnet
Mar 16, 2026
Merged

feat: Support optional spanKind override for InvokeAgentScope and ExecuteToolScope#213
nikhilNava merged 4 commits intomainfrom
copilot/implement-span-kind-dotnet

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 16, 2026

  • Create SpanKindConstants class with string constants (Server, Client, Producer, Consumer, Internal)
  • Update BaseData: Change ActivityKind? SpanKind to string? SpanKind
  • Update InvokeAgentData: Change ActivityKind? to string?, remove System.Diagnostics import
  • Update ExecuteToolData: Change ActivityKind? to string?, remove System.Diagnostics import
  • Update InvokeAgentDataBuilder: Change ActivityKind? to string?, remove System.Diagnostics import
  • Update ExecuteToolDataBuilder: Change ActivityKind? to string?, remove System.Diagnostics import
  • Update ExportFormatter.FormatLogData(): Include Kind field, default to SpanKindConstants.Client when null
  • Update all tests to use SpanKindConstants string values instead of ActivityKind enum
  • Update FormatLogData tests to verify Kind in JSON output
  • Build and run all tests (601 pass, 0 fail)
  • Code review: 0 comments
  • CodeQL: 0 alerts

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 16, 2026 14:54
…cope

Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
…ders, update FormatLogData with Kind default

Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
@nikhilNava nikhilNava marked this pull request as ready for review March 16, 2026 16:28
@nikhilNava nikhilNava requested a review from a team as a code owner March 16, 2026 16:28
Copilot AI review requested due to automatic review settings March 16, 2026 16:28
@github-actions
Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an optional span kind override capability to the runtime tracing scopes while also introducing a string-based span kind representation for DTO/log export to avoid taking a dependency on System.Diagnostics.ActivityKind in DTOs/builders.

Changes:

  • Add optional spanKind override parameter to InvokeAgentScope.Start (default Client) and ExecuteToolScope.Start (default Internal).
  • Introduce SpanKindConstants and plumb SpanKind through BaseData, operation DTOs, and DTO builders as a string?.
  • Extend ExportFormatter.FormatLogData and tests to emit/validate a Kind field, defaulting to Client when SpanKind is unset.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Observability/Runtime/Tracing/Scopes/InvokeAgentScope.cs Adds spanKind override support (defaults to Client).
src/Observability/Runtime/Tracing/Scopes/ExecuteToolScope.cs Adds spanKind override support (defaults to Internal).
src/Observability/Runtime/DTOs/SpanKindConstants.cs New string constants for span kind values.
src/Observability/Runtime/DTOs/BaseData.cs Adds SpanKind as string? and includes it in ToDictionary().
src/Observability/Runtime/DTOs/InvokeAgentData.cs Threads spanKind through to base DTO.
src/Observability/Runtime/DTOs/ExecuteToolData.cs Threads spanKind through to base DTO.
src/Observability/Runtime/DTOs/Builders/InvokeAgentDataBuilder.cs Adds passthrough spanKind parameter to builder.
src/Observability/Runtime/DTOs/Builders/ExecuteToolDataBuilder.cs Adds passthrough spanKind parameter to builder.
src/Observability/Runtime/Common/ExportFormatter.cs Adds Kind to formatted log payload with a default.
src/Tests/.../Tracing/Scopes/InvokeAgentScopeTest.cs Adds tests for default/overridden Activity.Kind.
src/Tests/.../Tracing/Scopes/ExecuteToolScopeTest.cs Adds tests for default/overridden Activity.Kind.
src/Tests/.../DTOs/InvokeAgentDataTests.cs Adds tests for DTO SpanKind default/override.
src/Tests/.../DTOs/ExecuteToolDataTests.cs Adds tests for DTO SpanKind default/override.
src/Tests/.../DTOs/Builders/InvokeAgentDataBuilderTests.cs Adds tests for builder spanKind passthrough.
src/Tests/.../DTOs/Builders/ExecuteToolDataBuilderTests.cs Adds tests for builder spanKind passthrough.
src/Tests/.../DTOs/BaseDataTests.cs Adds tests for base DTO SpanKind + dictionary inclusion.
src/Tests/.../Common/ExportFormatterTests.cs Adds assertions for Kind in log JSON output.

You can also share your feedback on Copilot code review. Take the survey.

@nikhilNava nikhilNava merged commit e50eae0 into main Mar 16, 2026
11 checks passed
@nikhilNava nikhilNava deleted the copilot/implement-span-kind-dotnet branch March 16, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants